package com.shipwe.loans.utils.dialog

import android.content.Context
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import com.shipwe.loans.R
import com.shipwe.loans.databinding.CheckNumberSendSuccessDialogBinding
import com.shipwe.loans.pro.ShipweDialog

/**
 * Shipwe
 * @Author wwdeng
 * @CreateTime: 2024/11/11 15:41
 * @Annotation：提示dialog
 */
class CheckNumberSendSuccessDialog: ShipweDialog {
    private lateinit var binding: CheckNumberSendSuccessDialogBinding
    private var mCallback: IDialogCallback? = null
    //事件备注
    private var eventRemark = ""

    override fun initWindow() {
        val params = window!!.attributes
        params.width = WindowManager.LayoutParams.WRAP_CONTENT
        params.height = WindowManager.LayoutParams.WRAP_CONTENT
        window!!.attributes = params
        window!!.setWindowAnimations(R.style.dialog_scale_anim) //修改动画样式
        window!!.setGravity(Gravity.CENTER)
    }

    constructor(context: Context) : super(context) {}
    constructor(context: Context, callback: IDialogCallback?) : super(context) {
        mCallback = callback
    }

    constructor(context: Context, remark: String, callback: IDialogCallback?) : super(context) {
        mCallback = callback
        eventRemark = remark
    }

    /**
     * 设置点击回调
     */
    fun setOnClick(callback: IDialogCallback){
        this.mCallback = callback
    }

    override fun getRootView(): View {
        binding = CheckNumberSendSuccessDialogBinding.inflate(LayoutInflater.from(context))
        return binding.root
    }

    override fun initView() {
    }

    override fun initListener() {
    }

    override fun initData() {
    }

    override fun onViewClick(v: View?) {
        dismiss()
    }

    /**
     * 设置埋点备注
     */
    fun setTipsEventRemark(remark: String){
        eventRemark = remark
    }

    interface IDialogCallback {
        //按钮点击
        fun onClick(view: View?)
    }
}